<template>
  <div>
    <van-nav-bar @click-left="$router.go(-1)" title="账号登录" left-arrow />
    <van-form @submit="onSubmit">
      <van-field
        v-model="username"
        name="用户名"
        placeholder="请输入账号"
        :rules="[
          { required: true, message: '请填写用户名' },
          { pattern: /\w{5,}/, message: '账号不能少于5个字符' }
        ]"
      />
      <van-field
        v-model="password"
        type="password"
        name="密码"
        placeholder="请输入密码"
        :rules="[
          { required: true, message: '请填写密码' },
          { pattern: /\w{6,}/, message: '密码不能少于6个字符' }
        ]"
      />
      <div style="margin: 16px">
        <van-button block type="info" native-type="submit">登录</van-button>
      </div>
    </van-form>
    <div class="zhuche">
      <p>还没有账号，去注册~</p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'login-page',
  components: {},
  props: {},
  data() {
    return {
      username: '',
      password: ''
    }
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    onSubmit(values) {
      console.log('submit', values)
    }
  }
}
</script>

<style lang="less" scoped>
::v-deep .van-nav-bar .van-icon {
  color: white;
}
.van-button--info {
  background-color: #21b97a;
  border: 1px solid #21b97a;
}
.zhuche p {
  margin-left: 50%;
  transform: translateX(-36%);
  font-size: 14px;
  margin-top: 30px;
}
::v-deep .van-field__control {
  height: 50px;
  font-size: 18px;
}
.van-form {
  margin-top: 14px;
}
</style>
